<template>
  <div class="interviewRecordBox">
    <div class="navBox">
      <p>面试记录</p>
      <el-button type="primary" text @click="dialogFormVisible = true">安排新面试</el-button>
    </div>
    <div class="h">查看并管理所有面试记录和结果</div>
    <div class="crad">
      <div class="headerCard">面试列表</div>
      <el-table :data="tableData" style="width: 100%">
        <el-table-column prop="name" label="候选人" />
        <el-table-column prop="zhiwei" label="职位" />
        <el-table-column prop="title" label="面试官" />
        <el-table-column prop="date" label="日期" />
        <el-table-column prop="time" label="时长" />
        <el-table-column prop="flag" label="状态" >
          <template #default="scope">
            <span class="flagBox">{{ scope.row.flag }}</span>
          </template>
        </el-table-column>
        <el-table-column prop="fen" label="得分" />
        <el-table-column prop="operation" label="操作" >
          <template #default="scope">
            <div class="operationBox">
              <img src="../../assets/yan.png" alt="眼睛">
              <div class="operationText">{{ scope.row.operation }}</div>
            </div>
          </template>
        </el-table-column>
      </el-table>
      <div class="fenYe">
        <div class="fenyeTxt">显示 1 到 3，共 15 条记录</div>
        <el-pagination background layout="prev, pager, next" :total="50" />
    </div>
    </div>
    
  </div>

  <!-- 弹窗 -->
  <el-dialog v-model="dialogFormVisible" title="安排面试" >
    <el-form :model="form">
      <!-- 选择候选人 -->
      <div class="dialogLis">
        <label class="dialogLis_txt" for="interview-candidate">选择候选人 <span style="color: red;">*</span></label>
        <el-select v-model="renAction" id="interview-candidate" placeholder="请选择候选人..." style="width: 240px">
          <el-option
            v-for="item in renOptions"
            :key="item.value"
            :label="item.label"
            :value="item.value"
          />
        </el-select>
      </div>
      <!-- 职位 -->
      <div class="dialogLis">
        <div class="dialogLis_txt">职位 <span style="color: red;">*</span></div>
        <el-select v-model="zhiAction" placeholder="请选择职位..." style="width: 240px">
          <el-option
            v-for="item in zhiOptions"
            :key="item.value"
            :label="item.label"
            :value="item.value"
          />
        </el-select>
      </div>
      <!-- 面试类型 -->
      <div class="dialogLis">
        <div class="dialogLis_txt">面试类型 <span style="color: red;">*</span></div>
        <el-select v-model="flagAction" placeholder="数字人面试" style="width: 240px">
          <el-option
            v-for="item in flagOptions"
            :key="item.value"
            :label="item.label"
            :value="item.value"
          />
        </el-select>
      </div>
      <!-- 面试日期 -->
      <div class="dateBox">
        <div class="dateLis">
          <div class="dateLis_txt">面试日期 <span style="color: red;">*</span></div>
          <el-date-picker
            style="width: 140px;"
            v-model="startDate"
            type="datetime"
            placeholder="年/月/日"
          />
        </div>
        <div class="dateLis">
          <div class="dateLis_txt">面试时间 <span style="color: red;">*</span></div>
          <el-time-picker v-model="interViewTime" placeholder="时间" />
        </div>
        <div class="dateLis">
          <div class="dateLis_txt">时长（分钟） <span style="color: red;">*</span></div>
          <input type="text" placeholder="选择时间" class="date_inp" v-model="duration">
        </div>
      </div>
      <!-- 面试官 -->
      <div class="dialogLis">
        <div class="dialogLis_txt">面试官 <span style="color: red;">*</span></div>
        <el-select v-model="GuanAction" placeholder="请选择面试官..." style="width: 240px">
          <el-option
            v-for="item in interViewGuan"
            :key="item.value"
            :label="item.label"
            :value="item.value"
          />
        </el-select>
      </div>
      <!-- 题目集 -->
      <div class="dialogLis">
        <div class="dialogLis_txt">题目集 <span style="color: #999;font-size: 11px;">（可多选）</span></div>
        <el-select v-model="duoAction" multiple style="width: 240px">
          <el-option
            v-for="item in interViewduo"
            :key="item.value"
            :label="item.label"
            :value="item.value"
          />
        </el-select>
      </div>
      <!-- 面试地点/链接 -->
      <div class="dialogLis">
        <div class="dialogLis_txt">面试地点/链接</div>
        <input type="text" v-model="didian" placeholder="会议室或在线会议链接" style="width: 100%;
          border: 1.5px solid rgba(206,212,218,1);
          box-sizing: border-box;height: 32px;border-radius: 4px;outline: none;padding-left: 10px;"
          >
      </div>
      <!-- 备注 -->
      <div class="dialogLis">
        <div class="dialogLis_txt">备注</div>
        <textarea rows="5" placeholder="面试注意事项或特殊要求" v-model="textArea" style="width: 100%;
          border: 1.5px solid rgba(206,212,218,1);
          box-sizing: border-box;border-radius: 4px;outline: none;padding-left: 10px;"></textarea>
      </div>
      <!-- 单选 -->
       <div class="form_check">
        <input type="checkbox" id="send-notification" checked>
        <label for="send-notification" style="color: #333;">发送面试通知邮件给候选人</label>
       </div>
       <div class="form_check">
        <input type="checkbox" id="add-calendar" checked>
        <label for="add-calendar" style="color: #333;">添加到日历</label>
       </div>
    </el-form>
    <template #footer>
      <span class="dialog-footer">
        <el-button @click="dialogFormVisible = false">取消</el-button>
        <el-button type="primary" @click="yesFn">安排面试</el-button>
      </span>
    </template>
  </el-dialog>
</template>

<script setup lang="ts">
import { reactive, ref } from 'vue'
const tableData = ref([
  {
    name:"丽丽",
    zhiwei:"产品经理",
    title:"数字人",
    date:"2025-03-24",
    time:"32分钟",
    flag:"已完成",
    fen:"87/100",
    operation:"查看"
  },
  {
    name:"丽丽",
    zhiwei:"产品经理",
    title:"数字人",
    date:"2025-03-24",
    time:"32分钟",
    flag:"未通过",
    fen:"87/100",
    operation:"查看"
  },
  {
    name:"丽丽",
    zhiwei:"产品经理",
    title:"数字人",
    date:"2025-03-24",
    time:"32分钟",
    flag:"已完成",
    fen:"87/100",
    operation:"查看"
  },
])

// 弹窗
const dialogFormVisible = ref(false)  //控制弹窗
const form = reactive({})

// 候选人
const renAction = ref('')
const renOptions = [
  {
    value: '请选择候选人',
    label: '请选择候选人',
  },
  {
    value: '张铭-前端开发工程师',
    label: '张铭-前端开发工程师',
  },
  {
    value: '李华-Java开发工程师',
    label: '李华-Java开发工程师',
  },
]

// 职位
const zhiAction = ref('')
const zhiOptions = [
  {
    value: '请选择职位',
    label: '请选择职位',
  },
  {
    value: '前端开发工程师',
    label: '前端开发工程师',
  },
  {
    value: 'Java开发工程师',
    label: 'Java开发工程师',
  },
]

// 面试类型
const flagAction = ref('')
const flagOptions = [
  {
    value: '数字人面试',
    label: '数字人面试',
  },
  {
    value: '人工面试',
    label: '人工面试',
  },
  {
    value: '混合面试',
    label: '混合面试',
  },
]

// 面试日期
const startDate = ref('') // 面试日期
const interViewTime = ref('') // 面试时间
const duration = ref('') // 时长（分钟）

// 面试类型
const GuanAction = ref('')
const interViewGuan = [
  {
    value: '刘强-前端开发',
    label: '刘强-前端开发',
  },
  {
    value: '陈静-后端开发',
    label: '陈静-后端开发',
  },
  {
    value: '林梦-UI设计',
    label: '林梦-UI设计',
  },
]

// 题目集
const duoAction = ref('')
const interViewduo = [
  {
    value: '初级前端开发题集',
    label: '初级前端开发题集',
  },
  {
    value: '高级后端开发题集',
    label: '高级后端开发题集',
  },
  {
    value: 'UI设计师评估题集',
    label: 'UI设计师评估题集',
  },
]

// 面试地点
const didian = ref('')
// 备注
const textArea = ref('')

const yesFn = ()=>{
  console.log(renAction.value)
}


</script>

<style scoped lang="scss">
.interviewRecordBox{
  width: 100%;
  padding-bottom: 60px;

  .navBox{
    width: 100%;
    height: 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;

    p{
      font-size: 24px;
      font-weight: bold;
      color: #333;
    }
  }

  .h{
    color: gray;
    font-size: 14px;
    margin-top: 4px;
  }

  .crad{
    width: 100%;
    background: #fff;
    border-radius: 3px;
    box-shadow: 0 0 6px 1px #e8e4e4;
    margin-top: 30px;

    .headerCard{
      height: 60px;
      padding-left: 20px;
      display: flex;
      align-items: center;
      font-weight: bold;
      border-bottom: 1px solid #ddd;
    }

    .flagBox{
      padding: 6px 10px 6px 10px;
      color: rgba(231,76,60,1);
      background-color: #efe8e8;
      border-radius: 50%;
      text-align: center;
      font-size: 12px;
      font-weight: bold;
    }

    .operationBox{
      width: 64px;
      height: 30px;
      background-color: #ebe0e0;
      border-radius: 4px;
      cursor: pointer;
      display: flex;
      justify-content: center;
      align-items: center;

      img{
        width: 16px;
        height: 12px;
        margin-right: 2px;
      }

      .operationText{
        font-weight: bold;
        font-size: 13px;
      }
    }
  }

  // 分页
  .fenYe{
      width: 100%;
      padding: 20px 10px 5px;
      box-sizing: border-box;
      display: flex;
      justify-content: space-between;

      .fenyeTxt{
        font-size: 14px;
      }
  }
}


// 弹窗
.dialogLis{
  margin-bottom: 20px;

  .dialogLis_txt{
    display: block;
    margin-bottom: 4px;
    color: #000;
  }
  
  .el-select{
    width: 100% !important;
  }
}

// 面试日期
.dateBox{
  width: 100%;
  margin-bottom: 20px;
  display: flex;
  justify-content: space-between;

  .date_inp{
    height: 27px;
    border: 1.5px solid rgb(219, 224, 230);
    border-radius: 3px;
  }

  .dateLis_txt{
    margin-bottom: 4px;
  }

}


</style>